﻿using System;
using System.Text;

namespace GPS.GPSLanguage
{
    class DGPSStationIDToken
    {
        internal static void ParseLanguage(GPSData gpsData, System.Collections.Queue q)
        {
            String stationIDToken = (string)q.Dequeue();
            int stationID = 0;
            try
            {
                if(stationIDToken.Length>0)
                    stationID = int.Parse(stationIDToken);
            }
            catch
            {

            }

            gpsData.SetDGPSStationID(stationID);

            switch (gpsData.MessageType)
            {
                case MessageType.GPGGA:
                    gpsData.SetGPSSentenceComplete();
                    break;
                default:
                    throw new InvalidLanguageException("How did you get here?");
            }
        }
    }
}
